package org.example.Controller;

import jakarta.annotation.Resource;
import org.example.common.Result;
import org.example.pojo.Banner;
import org.example.pojo.Query;
import org.example.service.BannerService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("Banner")
public class BannerController {
    @Resource
    private BannerService bannerService;
    @PostMapping("/list")
    public Result list(@RequestBody Query query){
        Result result=bannerService.getlist(query);
        return result;
    }
    @PostMapping("/add")
    public Result add(@RequestBody Banner banner){
        Result result=bannerService.add(banner);
        return result;
    }
    @PostMapping("/update")
    public Result update(@RequestBody Banner banner){
        Result result=bannerService.updatebanner(banner);
        return result;
    }
    @PostMapping("/delete")
    public Result delete(Integer id){
        Result result=bannerService.delete(id);
        return result;
    }
    @PostMapping("/getall")
    public Result getall(){
        Result result=bannerService.getall();
        return result;
    }
}
